"use strict";
cc._RF.push(module, '962063O8rBMQI8sY9rqAv4e', 'GamePKScene');
// scripts/GamePKScene.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("CarView"),
    s = t("CarWeaponView"),
    l = t("GameConstant"),
    c = t("CarConstant"),
    d = t("GamePKView"),
    h = t("GamePKCameraControl"),
    p = t("PKSpinningBlade"),
    u = t("AudioControl"),
    f = t("SoundManager"),
    m = t("GlobalUserData"),
    _ = t("GameRoleView"),
    y = t("Util"),
    g = t("GameManage"),
    v = t("GameMatchView"),
    C = t("GameAirShip"),
    b = t("GameLandPhyControl"),
    w = t("HallConstant"),
    S = t("Global"),
    I = t("GameArenaView"),
    B = t("PropsView"),
    T = t("ScreenShotNode"),
    A = t("SuperChariot"),
    G = t("CarIconView"),
    D = t("ChampionManager"),
    O = t("SkillCtrolView"),
    R = cc._decorator,
    P = R.ccclass,
    U = R.property,
    x = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.pfb_match = null, e.pfb_arena = null, e.pfb_prop = null, e.pfb_airShip = null, e.btnGameStart = null, e.pfb_gameRole = null, e.pfb_arrCar = new Array(), e.pfb_arrWeapon = new Array(), e.pfb_blade = null, e.camera_Control = null, e.land_Pk_0 = null, e.land_Pk_1 = null, e.land_Pk_2 = null, e.icon_moveLeft = null, e.icon_moveRight = null, e.icon_btn_useTools = null, e.icon_cd_useTools = null, e.node_guide = null, e.node_content = null, e.spr_result = null, e.sf_resultArr = [], e.recorderNode = null, e.btnStartRecord = null, e.btnStopRecord = null, e.node_carIconContentL = null, e.node_carIconContentR = null, e.pfb_carIcon = null, e.spr_headFrame = null, e.spr_enemy_headFrame = null, e.label_trophy = null, e.label_etrophy = null, e.skillView = null, e.arr_carIconL = new Array(), e.arr_carIconR = new Array(), e.nCurGameIndex = 0, e.nCurLeftIndex = 0, e.nCurRightIndex = 0, e.nLeftWinBount = 0, e.nRightWinBount = 0, e.nLeftCarFailNum = 0, e.nRightCarFailNum = 0, e.left_BladeControl = null, e.right_BladeControl = null, e._land_Control = null, e._gameView = null, e._audioControl = null, e._gameRole = null, e.isGameStart = !1, e.rEquipBodyData = null, e.rEquipWheelData = null, e.rEquipWeaponData = null, e.rEquipToolsData = null, e.bInitEnded = !1, e.nBoundaryWidth = 0, e.istouching = !1, e.eventTouchTag = 1, e.leftCarCount = 0, e.rightCarCount = 0, e.isShowBanner = !1, e.bTouchStartTools = !1, e.bTouchStartLeft = !1, e.bTouchStartRight = !1, e.bLefClickBtn = !0, e.bRightClickBtn = !0, e.bLeftTouchBtn = !1, e.bRightTouchBtn = !1, e.bCdUseToolsing = !1, e;
  }

  return n(e, t), e.prototype.onLoad = function () {
    switch (cc.director.getPhysicsManager().enabled = !0, cc.director.getCollisionManager().enabled = !0, this._gameView = this.node.getComponent(d["default"]), this._audioControl = this.node.getComponent(u["default"]), this.container = this.node_content, this.setLandType(), this.initData(), m["default"].gameMode) {
      case S.GameMode.Match:
        this.createMatchView();
        break;

      default:
        this.createArenaView();
    }
  }, e.prototype.onRestartGame = function () {
    this._gameRole = null, this._gameView.onRestartGame(), this.setLandType(), this.initData(), this.createMatchView();
  }, e.prototype.onRestartArenaGame = function () {
    this._gameRole = null, this._gameView.onRestartGame(), this.setLandType(), this.initData(), this.createArenaView();
  }, e.prototype.onRecordStart = function () {
    this.btnStartRecord.active = !1, this.btnStopRecord.active = !0, y.Util.startRecord();
  }, e.prototype.onRecordEnd = function () {
    this.btnStartRecord.active = !0, this.btnStopRecord.active = !1, y.Util.stopRecord();
  }, e.prototype.game_Equip_Max = function () {
    return l.Game_Equip_Max;
  }, e.prototype.game_Bout_Max = function () {
    return l.Game_Bout_Max;
  }, e.prototype.initData = function () {
    this.nCurGameIndex = 0, this.nCurLeftIndex = 0, this.nCurRightIndex = 0, this.nLeftWinBount = 0, this.nRightWinBount = 0, this.nLeftCarFailNum = 0, this.nRightCarFailNum = 0, this.node_guide.active = !1;
  }, e.prototype.setLandType = function () {
    for (var t = y.Util.getRandomInt(0, 3); m["default"].nCurGameType == t;) {
      t = y.Util.getRandomInt(0, 3);
    }

    m["default"].nCurGameType = t, m["default"].nCurGameType == l.Game_Type.PK ? (this.nBoundaryWidth = 0, this.land_Pk_1.active = !1, this.land_Pk_2.active = !1, this.land_Pk_0.active = !0, this._land_Control = this.land_Pk_0.getChildByName("land").getComponent(b["default"])) : m["default"].nCurGameType == l.Game_Type.PK_1 ? (this.land_Pk_0.active = !1, this.land_Pk_2.active = !1, this.nBoundaryWidth = (cc.winSize.width - this.land_Pk_1.getChildByName("land").width) / 2, this.land_Pk_1.active = !0, this._land_Control = this.land_Pk_1.getChildByName("land").getComponent(b["default"])) : m["default"].nCurGameType == l.Game_Type.PK_2 && (this.land_Pk_0.active = !1, this.land_Pk_1.active = !1, this.nBoundaryWidth = 0, this.land_Pk_2.active = !0, this._land_Control = this.land_Pk_2.getChildByName("land").getComponent(b["default"])), this._land_Control.init(this);
  }, e.prototype.start = function () {
    this.spr_result.node.active = !1;
  }, e.prototype.update = function (t) {
    if (this.bInitEnded && !this.isGameOver) {
      var e = this._carLeftView.getCarPos(),
          o = this._carRightView.getCarPos();

      this._weaponLeftView.setPos(e);

      var i = this._carLeftView.getAngle();

      this._weaponLeftView.setAngle(i), this._weaponRightView.setPos(o);

      var n = this._carRightView.getAngle();

      this._weaponRightView.setAngle(n), this.isGameStart && (this._carRightView.onAIMove(t, n), this._weaponRightView.onAIUseTools(t), this._airShipLeft.onCarAngle(i, t), this._airShipRight.onCarAngle(n, t));
    }
  }, e.prototype.createMatchView = function () {
    var t = cc.instantiate(this.pfb_match);
    this.node_content.addChild(t, l.Scene_Z_Index.Match), t.getComponent(v["default"]).initView(this);
  }, e.prototype.createArenaView = function () {
    var t = cc.instantiate(this.pfb_arena);
    this.node.addChild(t), t.getComponent(I["default"]).initView(this);
  }, e.prototype.initView = function () {
    this.initCarLeft(), this.initCarRight(), this.initCarLeftWeapon(), this.initCarRightWeapon(), this.initGameRole(), this.initSceneBlade(), this.initBtnState(), this.initBtnEvent(), this._gameView.initView(), this.camera_Control.init(this), this.bInitEnded = !0, this.skillView.init(this);
  }, e.prototype.resetView = function () {
    this.initCarLeft(), this.initCarRight(), this.initCarLeftWeapon(), this.initCarRightWeapon(), this.initGameRole(), this.initBtnState(), this._gameView.resetView(), this.bInitEnded = !0;
  }, e.prototype.setRightInfo = function (t, e) {
    this._gameView.initRightView(t, e);
  }, e.prototype.resetDta = function () {
    this.bLefClickBtn = !0, this.bRightClickBtn = !0, this.bLeftTouchBtn = !1, this.bRightTouchBtn = !1;
  }, e.prototype.initRightData = function (t, e, o, i) {
    this.rEquipBodyData = t, this.rEquipWheelData = e, this.rEquipWeaponData = o, this.rEquipToolsData = i, this.nCurLeftIndex = this.nCurGameIndex;

    for (var n = 0; n < this.game_Equip_Max(); n++) {
      if (m["default"].curEquipBody[this.nCurLeftIndex]) {
        this._gameView.initLeftData(m["default"].curEquipBody[this.nCurLeftIndex], m["default"].curEquipWeapon[this.nCurLeftIndex], m["default"].curEquipWheel[this.nCurLeftIndex], m["default"].curEquipTools[this.nCurLeftIndex]);

        break;
      }

      this.nCurLeftIndex++, this.nCurLeftIndex >= this.game_Equip_Max() && (this.nCurLeftIndex = 0);
    }

    for (this.nCurRightIndex = this.nCurGameIndex, n = 0; n < this.game_Equip_Max(); n++) {
      if (this.rEquipBodyData[this.nCurRightIndex]) {
        this._gameView.initRightData(this.rEquipBodyData[this.nCurRightIndex], this.rEquipWheelData[this.nCurRightIndex], this.rEquipWeaponData[this.nCurRightIndex], this.rEquipToolsData[this.nCurRightIndex]);

        break;
      }

      this.nCurRightIndex++, this.nCurRightIndex >= this.game_Equip_Max() && (this.nCurRightIndex = 0);
    }

    this.initView(), this.initCarIconView(t, e, o, i);
  }, e.prototype.initCarIconView = function (t, e, o, i) {
    for (var n = 0; n < m["default"].curEquipBody.length; n++) {
      if (y.Util.getBodyData(m["default"].curEquipBody[n])) {
        this.leftCarCount++;
        var a = cc.instantiate(this.pfb_carIcon);
        this.node_carIconContentL.addChild(a);

        for (var r = y.Util.getBodyData(m["default"].curEquipBody[n]), s = [], l = [], c = [], d = 0; d < m["default"].curEquipWeapon[n].length; d++) {
          var h = y.Util.getWeaponData(m["default"].curEquipWeapon[n][d]);
          s.push(h);
        }

        for (d = 0; d < m["default"].curEquipWheel[n].length; d++) {
          h = y.Util.getWheelData(m["default"].curEquipWheel[n][d]), l.push(h);
        }

        for (d = 0; d < m["default"].curEquipTools[n].length; d++) {
          h = y.Util.getToolsData(m["default"].curEquipTools[n][d]), c.push(h);
        }

        a.getComponent(G["default"]).init(r, l, s, c, !0), this.arr_carIconL.push(a.getComponent(G["default"]));
      }
    }

    for (n = 0; n < t.length; n++) {
      t[n] && (this.rightCarCount++, a = cc.instantiate(this.pfb_carIcon), this.node_carIconContentR.addChild(a), a.getComponent(G["default"]).init(t[n], e[n], o[n], i[n], !1), this.arr_carIconR.push(a.getComponent(G["default"])));
    }

    this.arr_carIconL[0].refreshState(1), this.arr_carIconR[0].refreshState(1);
  }, e.prototype.onGameStart = function () {
    this.onGameStartCallBack();
  }, e.prototype.onGameStartCallBack = function () {
    var t = this;
    y.Util.is_tt() && (this.recorderNode.active = !0, this.onRecordStart(), setTimeout(function () {
      T["default"].take();
    }, 3e3)), y.Util.wxAldGameReport("" + (m["default"].nGameLevel + 1), "game_start"), this.isGameStart = !0, this.isGameOver = !1, this.playMusic(this._audioControl.bgm_gameFight), this._gameView.onGameStart(), this._land_Control.onGameStart(), this._carLeftView.onGameStart(), this._carRightView.onGameStart(), this._weaponLeftView.onGameStart(), this._weaponRightView.onGameStart(), this.left_BladeControl.onGameStart(), this.right_BladeControl.onGameStart(), this.camera_Control.onGameStart(), this.scheduleOnce(function () {
      t.onGameBoutStart();
    }, l.GameStart_Time_interval);
  }, e.prototype.onGameOver = function () {
    this.onRecordEnd(), this.btnStartRecord.active = !1, console.log("录屏结束"), y.Util.hideSingleCustomAd(!0, "game"), y.Util.hideSingleCustomAd(!1, "game"), y.Util.hideBanner(), this.isGameStart = !1, this.isGameOver = !0, this.playMusic(this._audioControl.bgm_game), this._gameView.onGameOver(this.arr_carIconL, this.arr_carIconR), this._land_Control.onGameOver(), this._carLeftView.onGameOver(), this._carRightView.onGameOver(), this._weaponLeftView.onGameOver(), this._weaponRightView.onGameOver(), this._gameRole.onGameOver(), this.left_BladeControl.onGameOver(), this.right_BladeControl.onGameOver(), this.camera_Control.onGameOver(), m["default"].saveGameLevelData();
  }, e.prototype.onGameWin = function () {
    switch (y.Util.wxAldGameReport("" + (m["default"].nGameLevel + 1), "game_win"), m["default"].saveTotalGame(!0), m["default"].saveWinning(!0), m["default"].saveAIDifficultyLevelData(!0), m["default"].gameMode) {
      case S.GameMode.Match:
        m["default"].saveWinTotal(!0);
        break;

      default:
        m["default"].userArenaData.canRefresh = !0, m["default"].saveRefreshArenaData(), m["default"].saveArenaModeData(!1, m["default"].nCurArenaOpponentData), m["default"].saveArenaWinTotal(!0);
    }

    this.onGameOver(), this._gameView.onGameWin(), this._carLeftView.onGameWin(), this._carRightView.onGameFail(), this._weaponLeftView.onGameWin(), this._weaponRightView.onGameFail();
  }, e.prototype.onGameFail = function () {
    y.Util.wxAldGameReport("" + (m["default"].nGameLevel + 1), "game_fail"), m["default"].saveAIDifficultyLevelData(!1), m["default"].saveTotalGame(!1), m["default"].saveWinning(!1), m["default"].saveFailTotal(!0), this.onGameOver(), this._gameView.onGameFail(), this._carLeftView.onGameFail(), this._carRightView.onGameWin(), this._weaponRightView.onGameWin(), this._weaponLeftView.onGameFail();
  }, e.prototype.onGameBoutReady = function () {
    var t = this;
    this.nCurGameIndex++, this.nCurGameIndex >= this.game_Bout_Max() && (this.nCurGameIndex = 0), this.setLandType(), this.bInitEnded = !1, this._gameRole.onGameBoutReady(), this._carLeftView.onGameBoutReady(), this._carLeftView = null, this._carRightView.onGameBoutReady(), this._carRightView = null, this._weaponLeftView.onGameBoutReady(), this._weaponLeftView = null, this._weaponRightView.onGameBoutReady(), this._weaponRightView = null, this.scheduleOnce(function () {
      t.curHpLeft <= 0 && (m["default"].isTryCar = !1, t.arr_carIconL[t.nCurLeftIndex].refreshState(2), t.nCurLeftIndex++, t.arr_carIconL[t.nCurLeftIndex].refreshState(1));

      for (var e = 0; e < t.game_Equip_Max(); e++) {
        if (m["default"].curEquipBody[t.nCurLeftIndex] && 1 != m["default"].curEquipBody[t.nCurLeftIndex]) {
          t._gameView.initLeftData(m["default"].curEquipBody[t.nCurLeftIndex], m["default"].curEquipWeapon[t.nCurLeftIndex], m["default"].curEquipWheel[t.nCurLeftIndex], m["default"].curEquipTools[t.nCurLeftIndex], t.curHpLeft <= 0 ? null : t.curHpLeft);

          break;
        }

        t.nCurLeftIndex++;
      }

      for (t.curHpRight <= 0 && (t.arr_carIconR[t.nCurRightIndex].refreshState(2), t.nCurRightIndex++, t.arr_carIconR[t.nCurRightIndex].refreshState(1)), e = 0; e < t.game_Equip_Max(); e++) {
        if (t.rEquipBodyData[t.nCurRightIndex]) {
          t._gameView.initRightData(t.rEquipBodyData[t.nCurRightIndex], t.rEquipWheelData[t.nCurRightIndex], t.rEquipWeaponData[t.nCurRightIndex], t.rEquipToolsData[t.nCurRightIndex], t.curHpRight <= 0 ? null : t.curHpRight);

          break;
        }

        t.nCurRightIndex++, t.nCurRightIndex >= t.game_Equip_Max() && (t.nCurRightIndex = 0);
      }

      t.resetView(), t.scheduleOnce(function () {
        t.onGameBoutStart();
      }, l.GameStart_Time_interval);
    }, .2);
  }, e.prototype.onGameBoutStart = function () {
    y.Util.getToolsData(m["default"].curEquipTools[this.nCurLeftIndex][0]) && m["default"].nGuideStep == w.Guide_Step.playharpoon && this.onShowGuide(), this.skillView.showSkillBar(), this.isGameStart = !0, this._gameView.onGameBoutStart(), this._land_Control.onGameBoutStart(), this._airShipLeft.onGameBoutStart(), this._airShipRight.onGameBoutStart(), this._carLeftView.onGameBoutStart(), this._carRightView.onGameBoutStart(), this._weaponLeftView.onGameBoutStart(), this._weaponRightView.onGameBoutStart(), this.left_BladeControl.onGameBoutStart(), this.right_BladeControl.onGameBoutStart(), this.resetDta();
  }, e.prototype.onGameBoutOver = function (t) {
    var e,
        o = this;
    void 0 === t && (t = !1), this.skillView.hideSkillBar(), this.curHpLeft = this._gameView.curHpLeft, this.curHpRight = this._gameView.curHpRight, m["default"].propType = S.Props.Unknown, this.isGameStart = !1, this._gameView.onGameBoutOver(), this._land_Control.onGameBoutOver(), this._airShipLeft.onGameBoutOver(), this._airShipRight.onGameBoutOver(), this._carLeftView.onGameBoutOver(), this._carRightView.onGameBoutOver(), this._weaponLeftView.onGameBoutOver(), this._weaponRightView.onGameBoutOver(), this.left_BladeControl.onGameBoutOver(), this.right_BladeControl.onGameBoutOver(), this.nCurRightIndex >= this.arr_carIconR.length - 1 && !t ? (e = "win", this.playResultAnim(this.sf_resultArr[0])) : this.nCurLeftIndex >= this.arr_carIconL.length - 1 && t ? (e = "fail", this.playResultAnim(this.sf_resultArr[1])) : e = "ready", this.scheduleOnce(function () {
      switch (o.spr_result.node.active = !1, e) {
        case "win":
          o.arr_carIconR[o.arr_carIconR.length - 1].refreshState(2), o.onGameWin();
          break;

        case "fail":
          o.arr_carIconL[o.arr_carIconL.length - 1].refreshState(2), o.onGameFail();
          break;

        default:
          var i = o.curHpLeft <= 0 ? o.nCurLeftIndex + 1 : o.nCurLeftIndex;
          if (y.Util.is_tt() && m["default"].bAuditMode || m["default"].nTotalGame <= 3) return void o.onGameBoutReady();

          if (t) {
            if (y.Util.superCarSwapData(!1), 2 == o.nRightWinBount && y.Util.probability(m["default"].superCarPro)) o.superChariot(i);else {
              var n = cc.instantiate(o.pfb_prop);
              n.getComponent(B["default"]).init(o.onGameBoutReady.bind(o)), o.node.addChild(n, 9999);
            }
          } else 0 == o.nCurGameIndex && y.Util.probability(m["default"].superCarPro) ? o.superChariot(i) : o.onGameBoutReady();

      }
    }, 3.6);
  }, e.prototype.superChariot = function (t) {
    var e = this;
    cc.resources.load("prefab/superChariot", cc.Prefab, function (o, i) {
      var n = cc.instantiate(i);
      n.getComponent(A["default"]).init(t, e.superCarBackCall.bind(e)), e.node.addChild(n, 9999);
    });
  }, e.prototype.superCarBackCall = function () {
    m["default"].saveGuideStepData(w.Guide_Step.Finish), this.scheduleOnce(this.onGameBoutReady, .5);
  }, e.prototype.playResultAnim = function (t) {
    this.spr_result.spriteFrame = t, this.spr_result.node.setSiblingIndex(999), this.spr_result.node.active = !0, this.spr_result.node.scale = 0, cc.tween(this.spr_result.node).to(1, {
      scale: 1
    }, {
      easing: "elasticOut"
    }).start();
  }, e.prototype.onGameBoutWin = function () {
    this.nLeftWinBount++, this.nRightCarFailNum++, this.playFailAniRole(!1), this.onGameBoutOver(), this._carLeftView.onGameBoutWin(), this._carRightView.onGameBoutFail(), this._weaponLeftView.onGameBoutWin(), this._weaponRightView.onGameBoutFail();
  }, e.prototype.onGameBoutFail = function () {
    this.nRightWinBount++, this.nLeftCarFailNum++, this.playFailAniRole(!0), this.onGameBoutOver(!0), this._carLeftView.onGameBoutFail(), this._carRightView.onGameBoutWin(), this._weaponLeftView.onGameBoutFail(), this._weaponRightView.onGameBoutWin();
  }, e.prototype.playFailAniRole = function (t) {
    if (!this._gameRole) {
      var e = cc.instantiate(this.pfb_gameRole);
      this.node_content.addChild(e, l.Scene_Z_Index.GameRole), this._gameRole = e.getComponent(_["default"]), this._gameRole.init();
    }

    var o = null;
    t ? (o = this._carLeftView.getCarPos(), this._gameRole.palyAniFail(o, l.Physics_Car_Tag.Left)) : (o = this._carRightView.getCarPos(), this._gameRole.palyAniFail(o, l.Physics_Car_Tag.Right));
  }, e.prototype.initCarLeft = function () {
    var t,
        e = y.Util.getBodyData(m["default"].curEquipBody[this.nCurLeftIndex]),
        o = c.GetCarBodyData(e.id);

    if (this._carLeftView ? this._carLeftView.getBodyId() != e.id && (this._carLeftView = null, t = cc.instantiate(this.pfb_arrCar[o.index]), this.node_content.addChild(t, l.Scene_Z_Index.Car), this._carLeftView = t.getComponent(r["default"])) : (t = cc.instantiate(this.pfb_arrCar[o.index]), this.node_content.addChild(t, l.Scene_Z_Index.Car), this._carLeftView = t.getComponent(r["default"])), this.setPropView(t), this._carLeftView.init(this, l.Physics_Car_Tag.Left, o.gameLeftPos, e.id, m["default"].curEquipWheel[this.nCurLeftIndex], e.quality), !this._airShipLeft) {
      var i = cc.instantiate(this.pfb_airShip);
      this.node_content.addChild(i, l.Scene_Z_Index.AirShip), this._airShipLeft = i.getComponent(C["default"]);
    }

    this._airShipLeft.initView(this, l.Physics_Car_Tag.Left, o.gameLeftPos);
  }, e.prototype.setPropView = function (t) {
    if (!(m["default"].propType - 1 < 0)) {
      var e = cc.instantiate(m["default"].pbf_propsArr[m["default"].propType - 1]);
      e && (m["default"].propType == S.Props.Shield ? (e.y = e.y - 100, e.scale = 2, this.shield = e) : e.scale = 1, t.getChildByName("carLeft").addChild(e, 999));
    }
  }, e.prototype.initCarRight = function () {
    var t = c.GetCarBodyData(this.rEquipBodyData[this.nCurRightIndex].id);
    if (this._carRightView) this._carRightView.getBodyId() != t.id && (this._carRightView = null, e = cc.instantiate(this.pfb_arrCar[t.index]), this.node_content.addChild(e, l.Scene_Z_Index.Car), this._carRightView = e.getComponent(r["default"]));else {
      var e = cc.instantiate(this.pfb_arrCar[t.index]);
      this.node_content.addChild(e, l.Scene_Z_Index.Car), this._carRightView = e.getComponent(r["default"]);
    }

    if (this._carRightView.init(this, l.Physics_Car_Tag.Right, t.gameRightPos, this.rEquipBodyData[this.nCurRightIndex].id, this.rEquipWheelData[this.nCurRightIndex], this.rEquipBodyData[this.nCurRightIndex].quality), !this._airShipRight) {
      var o = cc.instantiate(this.pfb_airShip);
      this.node_content.addChild(o, l.Scene_Z_Index.AirShip), this._airShipRight = o.getComponent(C["default"]);
    }

    this._airShipRight.initView(this, l.Physics_Car_Tag.Right, t.gameRightPos);
  }, e.prototype.initCarLeftWeapon = function () {
    var t = y.Util.getBodyData(m["default"].curEquipBody[this.nCurLeftIndex]),
        e = c.GetCarBodyData(t.id);
    if (this._weaponLeftView) this._weaponLeftView.getBodyId() != t.id && (this._weaponLeftView = null, o = cc.instantiate(this.pfb_arrWeapon[e.index]), this.node_content.addChild(o, l.Scene_Z_Index.Weapon), this._weaponLeftView = o.getComponent(s["default"]));else {
      var o = cc.instantiate(this.pfb_arrWeapon[e.index]);
      this.node_content.addChild(o, l.Scene_Z_Index.Weapon), this._weaponLeftView = o.getComponent(s["default"]);
    }

    if (l.Cur_Game_Type == l.Game_Type.PK) {
      this._weaponLeftView.node.scale = l.Game_Type_Scale.PK;
      var i = e.gameLeftPos;
      this._weaponLeftView.node.position = cc.v3(i.x, i.y + l.Game_PK_Car_PosY, i.z);
    } else this._weaponLeftView.node.position = e.gameLeftPos;

    this._weaponLeftView.init(this, l.Car_Site.Left, t.id, m["default"].curEquipWheel[this.nCurLeftIndex], m["default"].curEquipWeapon[this.nCurLeftIndex], m["default"].curEquipTools[this.nCurLeftIndex]);
  }, e.prototype.initCarRightWeapon = function () {
    var t = c.GetCarBodyData(this.rEquipBodyData[this.nCurRightIndex].id);
    if (this._weaponRightView) this._weaponRightView.getBodyId() != t.id && (this._weaponRightView = null, e = cc.instantiate(this.pfb_arrWeapon[t.index]), this.node_content.addChild(e), this._weaponRightView = e.getComponent(s["default"]), e.zIndex = l.Scene_Z_Index.Weapon);else {
      var e = cc.instantiate(this.pfb_arrWeapon[t.index]);
      this.node_content.addChild(e), this._weaponRightView = e.getComponent(s["default"]), e.zIndex = l.Scene_Z_Index.Weapon;
    }

    if (l.Cur_Game_Type == l.Game_Type.PK) {
      this._weaponRightView.node.scale = l.Game_Type_Scale.PK;
      var o = t.gameRightPos;
      this._weaponRightView.node.position = cc.v3(o.x, o.y + l.Game_PK_Car_PosY, o.z);
    } else this._weaponRightView.node.position = t.gameRightPos;

    this._weaponRightView.init(this, l.Car_Site.Right, this.rEquipBodyData[this.nCurRightIndex].id, this.rEquipWheelData[this.nCurRightIndex], this.rEquipWeaponData[this.nCurRightIndex], this.rEquipToolsData[this.nCurRightIndex]);
  }, e.prototype.initGameRole = function () {
    this._gameRole && this._gameRole.init();
  }, e.prototype.initSceneBlade = function () {
    var t = cc.instantiate(this.pfb_blade);
    this.left_BladeControl = t.getComponent(p["default"]), this.left_BladeControl.init(this, l.Collide_Weapon_Tag.SceneLeft_Saw), this.node_content.addChild(t, l.Scene_Z_Index.SpinningBlad);
    var e = cc.instantiate(this.pfb_blade);
    this.right_BladeControl = e.getComponent(p["default"]), this.right_BladeControl.init(this, l.Collide_Weapon_Tag.SceneRight_Saw), this.node_content.addChild(e, l.Scene_Z_Index.SpinningBlad);
  }, e.prototype.onBtnGameStart = function () {
    var t = this;
    this.scheduleOnce(function () {
      t.label_trophy.string = m["default"].nTrophy.toString(), t.label_etrophy.string = m["default"].enemyTrophy.toString(), D["default"].Ins.setGradeWithFrame(t.spr_headFrame), D["default"].Ins.setGradeWithFrame(t.spr_enemy_headFrame, m["default"].enemyTrophy);
    }, .2), y.Util.hideNativeGridAd(), y.Util.hideNativeMatchBanner(), this.stopEngineAudio(), this.playSound(this._audioControl.click_gameStart), this.btnGameStart.active = !1, this.onGameStart();
  }, e.prototype.onShowGuide = function () {
    this.node_guide.zIndex = cc.macro.MAX_ZINDEX, this.node_guide.active = !0;
    var t = this.node_guide.getChildByName("hint").getChildByName("hand");
    t.stopAllActions(), t.y = t.y + 80;
    var e = cc.tween().by(1, {
      y: -100
    }, {
      easing: "sineOut"
    }),
        o = cc.tween().by(1, {
      y: 100
    }, {
      easing: "sineIn"
    }),
        i = cc.tween().sequence(e, o);
    cc.tween(t).repeatForever(i).start(), m["default"].saveGuideStepData(w.Guide_Step.boxHint);
  }, e.prototype.onHideGuide = function () {
    this.node_guide.active = !1;
  }, e.prototype.initBtnState = function () {
    return m["default"].curEquipTools[this.nCurLeftIndex] && m["default"].curEquipTools[this.nCurLeftIndex][0] ? (this.icon_btn_useTools.active = !0, !0) : (this.icon_btn_useTools.active = !1, !1);
  }, e.prototype.initBtnEvent = function () {
    this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStartCallBack, this, !0), this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMoveCallBack, this, !0), this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEndCallBack, this, !0), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchCancelCallBack, this, !0);
  }, e.prototype.onTouchStartCallBack = function (t) {
    if (!this.istouching) {
      this.eventTouchTag = 999, this.istouching = !0;
      var e = t.getTouches()[0].getLocation();
      if (this.isTouchBtnTools(e)) return this.bTouchStartTools = !0, void this.onBtnTouchStart(l.Scene_Btn_Type.UseTools);
      e.x < cc.winSize.width / 2 ? (this.bTouchStartLeft = !0, this.onBtnTouchStart(l.Scene_Btn_Type.MoveLeft)) : (this.bTouchStartRight = !0, this.onBtnTouchStart(l.Scene_Btn_Type.MoveRight));
    }
  }, e.prototype.onTouchMoveCallBack = function (t) {
    if (999 == this.eventTouchTag) {
      var e = t.getTouches()[0].getLocation();
      return this.bTouchStartTools && !this.isTouchBtnTools(e) ? (this.onBtnTouchEnd(l.Scene_Btn_Type.UseTools), void (this.bTouchStartTools = !1)) : void 0;
    }
  }, e.prototype.onTouchCancelCallBack = function () {
    if (999 == this.eventTouchTag) {
      if (this.istouching = !1, this.eventTouchTag = 1, this.bTouchStartTools) return this.onBtnTouchEnd(l.Scene_Btn_Type.UseTools), void (this.bTouchStartTools = !1);
      this.bTouchStartLeft && (this.onBtnTouchEnd(l.Scene_Btn_Type.MoveLeft), this.bTouchStartLeft = !1), this.bTouchStartRight && (this.onBtnTouchEnd(l.Scene_Btn_Type.MoveRight), this.bTouchStartRight = !1);
    }
  }, e.prototype.onTouchEndCallBack = function () {
    if (999 == this.eventTouchTag) {
      if (this.istouching = !1, this.eventTouchTag = 1, this.bTouchStartTools) return this.onBtnTouchEnd(l.Scene_Btn_Type.UseTools), void (this.bTouchStartTools = !1);
      this.bTouchStartLeft && (this.onBtnTouchEnd(l.Scene_Btn_Type.MoveLeft), this.bTouchStartLeft = !1), this.bTouchStartRight && (this.onBtnTouchEnd(l.Scene_Btn_Type.MoveRight), this.bTouchStartRight = !1);
    }
  }, e.prototype.isTouchBtnTools = function (t) {
    return this.icon_btn_useTools.getBoundingBoxToWorld().contains(t);
  }, e.prototype.onBtnTouchStart = function (t) {
    if (this.isGameStart) switch (t) {
      case l.Scene_Btn_Type.MoveLeft:
        this.onMoveLeft(l.Collide_Car_Tag.Left);
        break;

      case l.Scene_Btn_Type.MoveRight:
        this.onMoveRight(l.Collide_Car_Tag.Left);
        break;

      case l.Scene_Btn_Type.UseTools:
        this.onUseTools(l.Collide_Car_Tag.Left);
        break;

      case l.Scene_Btn_Type.UseWeapon:
        this._weaponLeftView.onUseWeapon();

    }
  }, e.prototype.setCanTouchBtn = function (t, e) {
    switch (t) {
      case l.Collide_Car_Tag.Left:
        this.bLeftTouchBtn = e;
        break;

      case l.Collide_Car_Tag.Right:
        this.bRightTouchBtn = e;
    }
  }, e.prototype.onUseTools = function (t, e) {
    switch (t) {
      case l.Collide_Car_Tag.Left:
        if (!this.bLeftTouchBtn || !this.bLefClickBtn) return;
        this.onHideGuide(), this.bCdUseToolsing || (this._weaponLeftView.onUseTools(e), this.onCDUseTools());
        break;

      case l.Collide_Car_Tag.Right:
        if (!this.bRightTouchBtn || !this.bRightClickBtn) return;

        this._weaponRightView.onUseTools(e);

    }
  }, e.prototype.onCDUseTools = function () {
    this.bCdUseToolsing = !0, this.icon_cd_useTools.active = !0, this.icon_cd_useTools.getComponent(cc.Sprite).fillRange = 1, this.schedule(this.changeProgressBar, .05);
  }, e.prototype.changeProgressBar = function () {
    this.icon_cd_useTools.getComponent(cc.Sprite).fillRange -= .05 / l.UseTools_CD_Time, this.icon_cd_useTools.getComponent(cc.Sprite).fillRange <= 0 && (this.unschedule(this.changeProgressBar), this.icon_cd_useTools.active = !1, this.bCdUseToolsing = !1);
  }, e.prototype.onMoveLeft = function (t, e) {
    var o;

    switch (o = !this._weaponLeftView.harpoonControl || !this._weaponLeftView.harpoonControl.bUseing, t) {
      case l.Collide_Car_Tag.Left:
        if (!this.bLeftTouchBtn || !this.bLefClickBtn) return;
        this.icon_moveLeft.getChildByName("icon_no").active = !1, this.icon_moveLeft.getChildByName("icon_touch").active = !0, this._carLeftView.onMoveLeft(e, o), this._weaponLeftView.onMoveLeft(o);
        break;

      case l.Collide_Car_Tag.Right:
        if (!this.bRightTouchBtn || !this.bRightClickBtn) return;
        this._carRightView.onMoveLeft(e, o), this._weaponRightView.onMoveLeft(o);
    }
  }, e.prototype.onMoveRight = function (t, e) {
    var o;

    switch (o = !this._weaponLeftView.harpoonControl || !this._weaponLeftView.harpoonControl.bUseing, t) {
      case l.Collide_Car_Tag.Left:
        if (!this.bLeftTouchBtn || !this.bLefClickBtn) return;
        this.icon_moveRight.getChildByName("icon_no").active = !1, this.icon_moveRight.getChildByName("icon_touch").active = !0, this._carLeftView.onMoveRight(e, o), this._weaponLeftView.onMoveRight(o);
        break;

      case l.Collide_Car_Tag.Right:
        if (!this.bRightTouchBtn || !this.bRightClickBtn) return;
        this._carRightView.onMoveRight(e, o), this._weaponRightView.onMoveRight(o);
    }
  }, e.prototype.onMoveCancel = function (t, e) {
    switch (t) {
      case l.Collide_Car_Tag.Left:
        this._carLeftView.onMoveCancel(e), this._weaponLeftView.onMoveCancel();
        break;

      case l.Collide_Car_Tag.Right:
        this._carRightView.onMoveCancel(e), this._weaponRightView.onMoveCancel();
    }
  }, e.prototype.onBtnTouchEnd = function (t) {
    if (this.isGameStart) switch (t) {
      case l.Scene_Btn_Type.MoveLeft:
        this.icon_moveLeft.getChildByName("icon_no").active = !0, this.icon_moveLeft.getChildByName("icon_touch").active = !1, this.onMoveCancel(l.Collide_Car_Tag.Left);
        break;

      case l.Scene_Btn_Type.MoveRight:
        this.icon_moveRight.getChildByName("icon_no").active = !0, this.icon_moveRight.getChildByName("icon_touch").active = !1, this.onMoveCancel(l.Collide_Car_Tag.Left);
        break;

      case l.Scene_Btn_Type.UseTools:
        this._weaponLeftView.onCancelUseTools();

        break;

      case l.Scene_Btn_Type.UseWeapon:
        this._weaponLeftView.onCancelUseWeapon();

    }
  }, e.prototype.getGamePKView = function () {
    return this._gameView;
  }, e.prototype.playHammerEffect = function (t, e, o) {
    void 0 === o && (o = c.Weapon_ID.Hammer), t == l.Collide_Car_Tag.Left ? this._carLeftView.playHammerEffect(e, o) : t == l.Collide_Car_Tag.Right && this._carRightView.playHammerEffect(e, o);
  }, e.prototype.mineBlowOff = function (t, e) {
    t == l.Collide_Car_Tag.Left ? this._carLeftView.mineBlowOff(e) : t == l.Collide_Car_Tag.Right && this._carRightView.mineBlowOff(e);
  }, e.prototype.bombImpulse = function (t) {
    this._carRightView.bombImpulse(t);
  }, e.prototype.playThruster = function (t) {
    this.playAudio(l.Game_Audio_ID.thruster), t == l.Car_Site.Left ? this._carLeftView.playThruster() : t == l.Car_Site.Right && this._carRightView.playThruster();
  }, e.prototype.playRevThruster = function (t) {
    this.playAudio(l.Game_Audio_ID.thruster), t == l.Car_Site.Left ? this._carLeftView.playRevThruster() : t == l.Car_Site.Right && this._carRightView.playRevThruster();
  }, e.prototype.onDisassembly = function (t, e) {
    t == l.Car_Site.Left ? (this._carRightView.onDisassembly(e), this._weaponRightView.onDisassembly(e)) : t == l.Car_Site.Right && (this._carLeftView.onDisassembly(e), this._weaponLeftView.onDisassembly(e));
  }, e.prototype.onPlayHarpoon = function (t, e) {
    t == l.Collide_Car_Tag.Right ? this._weaponLeftView.onPlayHarpoon(e) : t == l.Collide_Car_Tag.Left && this._weaponRightView.onPlayHarpoon(e);
  }, e.prototype.onHarpoon = function (t, e) {
    t == l.Car_Site.Left ? this.bRightClickBtn = !e : t == l.Car_Site.Right && (this.bLefClickBtn = !e);
  }, e.prototype.onCanAttack = function (t, e) {
    t == l.Car_Site.Left ? (this._weaponRightView.onCanAttack(e), this._weaponLeftView.onTakeDamage(e)) : t == l.Car_Site.Right && (this._weaponLeftView.onCanAttack(e), this._weaponRightView.onTakeDamage(e));
  }, e.prototype.damageHp = function (t, e, o, i) {
    switch (t) {
      case l.Collide_Car_Tag.Left:
        if (o) m["default"].propType != S.Props.Shield ? this._gameView.damageHpLeft(0, o) : this.shield.active = !0, this.damageSceneSaw(t, e, this._carLeftView.getCarWorldPos());else {
          var n = this._weaponRightView.getDamage(e, i);

          this._gameView.damageHpLeft(n);
        }
        break;

      case l.Collide_Car_Tag.Right:
        if (o) this._gameView.damageHpRight(0, o), this.damageSceneSaw(t, e, this._carRightView.getCarWorldPos());else {
          var a = this._weaponLeftView.getDamage(e, i);

          this._gameView.damageHpRight(a);
        }
    }
  }, e.prototype.damageSceneSaw = function (t, e, o) {
    e == l.Collide_Weapon_Tag.SceneRight_Saw ? this.right_BladeControl.damageEffect(t, o) : e == l.Collide_Weapon_Tag.SceneLeft_Saw && this.left_BladeControl.damageEffect(t, o);
  }, e.prototype.weaponLeaveCar = function (t, e) {
    if (e != l.Collide_Weapon_Tag.SceneLeft_Saw) {
      if (e != l.Collide_Weapon_Tag.SceneRight_Saw) switch (t) {
        case l.Collide_Car_Tag.Left:
          this._weaponLeftView.weaponLeaveCar(e);

          break;

        case l.Collide_Car_Tag.Right:
          this._weaponRightView.weaponLeaveCar(e);

      } else this.right_BladeControl.weaponLeaveCar(t);
    } else this.left_BladeControl.weaponLeaveCar(t);
  }, e.prototype.onCollideCarBody = function (t, e, o) {
    this.isGameStart && (this._airShipRight.onCollideCarBody(t, e, o), this._airShipLeft.onCollideCarBody(t, e, o));
  }, e.prototype.onCollideCarWheel = function (t, e, o) {
    this.isGameStart && (this._airShipLeft && this._airShipLeft.onCollideCarWheel(t, e, o), this._airShipRight && this._airShipRight.onCollideCarWheel(t, e, o));
  }, e.prototype.onAirShipOut = function (t, e) {
    switch (t) {
      case l.Collide_Car_Tag.Left:
        this._carLeftView.onAirShipOut(t, e), this._weaponLeftView.onAirShipOut(e);
        break;

      case l.Collide_Car_Tag.Right:
        this._carRightView.onAirShipOut(t, e), this._weaponRightView.onAirShipOut(e);
    }

    this.setCanTouchBtn(t, !0);
  }, e.prototype.onAirShipIn = function (t) {
    switch (t) {
      case l.Collide_Car_Tag.Left:
        this._carLeftView.onAirShipIn(t), this._weaponLeftView.onAirShipIn();
        break;

      case l.Collide_Car_Tag.Right:
        this._carRightView.onAirShipIn(t), this._weaponRightView.onAirShipIn();
    }

    this.setCanTouchBtn(t, !1);
  }, e.prototype.getBoundaryWidth = function () {
    return this.nBoundaryWidth;
  }, e.prototype.playAudio = function (t) {
    return this._audioControl.playAudio(t);
  }, e.prototype.stopAudio = function (t) {
    this._audioControl.stopAudio(t);
  }, e.prototype.playMusic = function (t) {
    f["default"].GetInstance().playMusic(t);
  }, e.prototype.playSound = function (t, e) {
    void 0 === e && (e = 1), f["default"].GetInstance().playSound(t, e);
  }, e.prototype.stopSound = function (t) {
    f["default"].GetInstance().stopSoundLoop(t);
  }, e.prototype.playEngineAudio = function () {
    this._audioControl.playEngineAudio();
  }, e.prototype.stopEngineAudio = function () {
    this._audioControl.stopEngineAudio();
  }, a([U(cc.Prefab)], e.prototype, "pfb_match", void 0), a([U(cc.Prefab)], e.prototype, "pfb_arena", void 0), a([U(cc.Prefab)], e.prototype, "pfb_prop", void 0), a([U(cc.Prefab)], e.prototype, "pfb_airShip", void 0), a([U(cc.Node)], e.prototype, "btnGameStart", void 0), a([U(cc.Prefab)], e.prototype, "pfb_gameRole", void 0), a([U(cc.Prefab)], e.prototype, "pfb_arrCar", void 0), a([U(cc.Prefab)], e.prototype, "pfb_arrWeapon", void 0), a([U(cc.Prefab)], e.prototype, "pfb_blade", void 0), a([U(h["default"])], e.prototype, "camera_Control", void 0), a([U(cc.Node)], e.prototype, "land_Pk_0", void 0), a([U(cc.Node)], e.prototype, "land_Pk_1", void 0), a([U(cc.Node)], e.prototype, "land_Pk_2", void 0), a([U(cc.Node)], e.prototype, "icon_moveLeft", void 0), a([U(cc.Node)], e.prototype, "icon_moveRight", void 0), a([U(cc.Node)], e.prototype, "icon_btn_useTools", void 0), a([U(cc.Node)], e.prototype, "icon_cd_useTools", void 0), a([U(cc.Node)], e.prototype, "node_guide", void 0), a([U(cc.Node)], e.prototype, "node_content", void 0), a([U(cc.Sprite)], e.prototype, "spr_result", void 0), a([U(cc.SpriteFrame)], e.prototype, "sf_resultArr", void 0), a([U(cc.Node)], e.prototype, "recorderNode", void 0), a([U(cc.Node)], e.prototype, "btnStartRecord", void 0), a([U(cc.Node)], e.prototype, "btnStopRecord", void 0), a([U(cc.Node)], e.prototype, "node_carIconContentL", void 0), a([U(cc.Node)], e.prototype, "node_carIconContentR", void 0), a([U(cc.Prefab)], e.prototype, "pfb_carIcon", void 0), a([U(cc.Sprite)], e.prototype, "spr_headFrame", void 0), a([U(cc.Sprite)], e.prototype, "spr_enemy_headFrame", void 0), a([U(cc.Label)], e.prototype, "label_trophy", void 0), a([U(cc.Label)], e.prototype, "label_etrophy", void 0), a([U(O["default"])], e.prototype, "skillView", void 0), a([P], e);
}(g["default"]);

o["default"] = x;

cc._RF.pop();